package com.hq.door.controller;

import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hq.door.dto.OutRequest;
import com.hq.door.dto.OutrequestInfo;
import com.hq.door.dto.ParentInfoBack;
import com.hq.door.dto.TRecordInfo;
import com.hq.door.dto.Teacher;
import com.hq.door.service.TOutRequestService;

@Controller
@RequestMapping("/tourequest")
public class TOutRequestController {
	@Autowired
	TOutRequestService tOutRequestService;
	
	@RequestMapping("/showall")
	@ResponseBody
	public Object showmation(
			@RequestParam(value = "pageSize", required = false) Integer pageSize,
			@RequestParam(value = "pageStart", required = false) Integer pageStart){
		List<OutrequestInfo> list = tOutRequestService.showAll(pageStart, pageSize);
		return list;

	}
	@RequestMapping("/getCount")
	@ResponseBody
	public Object getPage(){
		int count = tOutRequestService.getCount();
		return count;
	}
	
	@RequestMapping("excelExport")
	public void excelExport(HttpServletResponse response){
		List<OutrequestInfo> infos = null;
		Integer type = 0;
		Integer pageSize = 100000000;
		Integer pageStart = 0;
		infos = tOutRequestService.showAll(pageStart, pageSize);
		tOutRequestService.excelExport(infos,response);
	}
	
	/**
	 * 学生端撤销申请
	 * @param pib
	 * @return
	 */
	
	@RequestMapping(value = "/modify", method = RequestMethod.POST)
	@ResponseBody
	public String modifyOutrequest(OutrequestInfo pib){
		String flag = tOutRequestService.modifyOutrequest(pib);
		return "\""+flag+"\"";
	}
}
